/* ========================================================================== */
/*   TagM.cpp    		                                                      */
/*   (c) 2012 Team 7 Hogeschool Utrecht ICT TI                                */
/*		Lars Stolwijk, Gerben Boot, Guido van Hienen, Marcel Boelen			  */
/*	 Responsible for the creation of the objects							  */
/* ========================================================================== */
#include "TagM.h"

#define log_steps (global_logging && 0)
#define log if (log_steps) { trace << ""; }

void TagM::run()
{
	if(global_logging){
		std::cout << "\n\nTagM::run(void)\n";
	}
	
	log Beeper gBeeper(1);

	log SoundController gSoundController(7, &gBeeper);
	
	log ReadLogHandler gReadLogHandler(8, &gSoundController);//log
	
	log Log gLog(9, &gReadLogHandler);
	
	log ProcessHitController gProcessHitController(2, &gSoundController, &gLog);//health
	
	log GameTime gGameTime(3, &gProcessHitController);
	
	log Health gHealth(4, &gProcessHitController);
	
	log GameHandler gGameHandler(6, &gSoundController, &gGameTime, &gHealth);
	
	log OperationController gOperationController(5, &gSoundController, &gGameHandler, &gLog);
	
	//log IRSensor gIRSensor(0, &gReadLogHandler, &gProcessHitController, &gOperationController);
	
	log IRSimulatie gIRSimulatie(0, &gReadLogHandler, &gProcessHitController, &gOperationController);
	
	gSoundController.RegisterHealth(&gHealth);
	
	gReadLogHandler.RegisterLog(&gLog);
	
	gProcessHitController.registerHealth(&gHealth);
	
	gGameTime.RegisterGameHandler(&gGameHandler);
	
	gHealth.RegisterGameHandler(&gGameHandler);
	
	log RTOS::run();
	
	std::cout << "-->end<--\n";
	
}
